package com.qdu.reducer;

import org.apache.hadoop.io.FloatWritable;
import org.apache.hadoop.io.IntWritable;
import org.apache.hadoop.io.Text;
import org.apache.hadoop.mapreduce.Reducer;
import java.io.IOException;
import java.io.PrintWriter;
import java.text.DecimalFormat;


public class WeekDayAvgReducer extends Reducer<Text, IntWritable, Text, IntWritable> {


    @Override
    protected void reduce(Text key, Iterable<IntWritable> values, Context context) throws IOException, InterruptedException {
        int sum=0;
        int count=0;
        for (IntWritable s :
                values) {
            sum+=s.get();
            count++;
        }

        context.write(new Text(key.toString()),new IntWritable(sum/count*24));
    }
}

